package mz.mobileservices.bim;

import mz.mobileservices.uem.R;
import mz.mobileservices.uem.SendSMS;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class PagamentoServicos extends Activity
{
	Button btnSendSMS, btnCancel;
	EditText txtConta, txtPinNo, txtMontante;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pagamento);
        
        btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
        btnCancel = (Button) findViewById(R.id.btnCancel);
        
        txtPinNo = (EditText) findViewById(R.id.txtPinNo);
        txtConta = (EditText) findViewById(R.id.txtConta);
        txtMontante = (EditText) findViewById(R.id.txtMontante);

        btnCancel.setOnClickListener (new View.OnClickListener() 
        {	
			public void onClick(View v) 
			{
				finish();	
			}
		});
        
        btnSendSMS.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {               
            	String conta = txtConta.getText().toString();
                String pinNo =  txtPinNo.getText().toString();
                String montante = txtMontante.getText().toString();
                                      
                if (pinNo.length()==0 || conta.length()==0 || montante.length()==0)
                {
                	Toast.makeText(getBaseContext(), "Por favor preencha todos os campos.", Toast.LENGTH_SHORT).show(); 
                }
                
                else	
                {
                	String message = "BIM PS "+conta+" "+montante+" "+pinNo;                	    
              		Intent i = new Intent(getApplicationContext(),SendSMS.class);
              		i.putExtra("numero","822424");
              		i.putExtra("comando",message);
              		  
              		startActivity(i);
              		finish();
                }
            }
        });        
    }
}